Skip to content

[Core] DrawMesh<Hexahedron>: add quick test for quads when drawing hexa#6152

Open
fredroy wants to merge 2 commits into
sofa-framework:masterfrom
fredroy:avoid_crash_sparsegrid_drawhexa
Open

[Core] DrawMesh<Hexahedron>: add quick test for quads when drawing hexa#6152
fredroy wants to merge 2 commits into
sofa-framework:masterfrom
fredroy:avoid_crash_sparsegrid_drawhexa

Conversation

@fredroy

@fredroy fredroy commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

More a hotfix than a real fix:
-> #6151

as I think sparsegrid and hexahedronFEMForceField are quite used here and there.

The real fix(es) should be:

  • sparsegrid should also generate quads ?
  • DrawMesh (all the primitives) should check the consistency of the topology ?
  • even better, DrawMesh should just generates its own facets but slower of course

and maybe, doing the same for triangles and Tetrahedron ?


By submitting this pull request, I acknowledge that
I have read, understand, and agree SOFA Developer Certificate of Origin (DCO).


Reviewers will merge this pull-request only if

  • it builds with SUCCESS for all platforms on the CI.
  • it does not generate new warnings.
  • it does not generate new unit test failures.
  • it does not generate new scene test failures.
  • it does not break API compatibility.
  • it is more than 1 week old (or has fast-merge label).

@fredroy fredroy added pr: fix Fix a bug pr: fast merge Minor change that can be merged without waiting for the 7 review days pr: status to review To notify reviewers to review this pull-request labels Jun 15, 2026
@fredroy fredroy added this to the v26.06 milestone Jun 15, 2026
@hugtalbot

Copy link
Copy Markdown
Contributor

The change obviously suits me but it could be indeed worth it to discuss it with Alex (author of DrawMesh) and Erik (for topologies)
For consistency, I would at least to the same for triangles and Tetrahedron, as suggested 👍

@bakpaul

bakpaul commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

I would advocate going for the third option when no facet is available in the topology. And it would only be slower for the first timestep.

@fredroy

fredroy commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

I would advocate going for the third option when no facet is available in the topology. And it would only be slower for the first timestep.

The problem with that solution is that:

  • we need to store the generated quads
  • we will still need to keep track of the hexas' state in case of a topology change (removal of an hexa for example)
  • will quite change the "spirit" of this class

So in this case, the best would be that the topology itself manages the quad (the problem in the first place actually) with a function like BaseMeshTopology::generateSubElements<Hexa,Quad> or something like that.

Finally my preferred solution actually would be simply to call drawHexahedra() instead of drawQuads from the DrawTool, which is taking care of creating the visual quads itself. But maybe @alxbilger had a reason to not call it.

@bakpaul bakpaul added pr: status ready Approved a pull-request, ready to be squashed and removed pr: status to review To notify reviewers to review this pull-request labels Jun 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr: fast merge Minor change that can be merged without waiting for the 7 review days pr: fix Fix a bug pr: status ready Approved a pull-request, ready to be squashed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants